package com.gui.employee.controller;

import com.gui.common.Result;
import com.gui.employee.entity.EmployeeDO;
import com.gui.employee.entity.EmployeeVO;
import com.gui.employee.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/employee")
@RestController
public class EmployeeController {

    @Autowired
    private EmployeeService employeeService;


    @RequestMapping("/get/{empNo}")
    public Result<EmployeeVO> get(@PathVariable Integer empNo){
        return Result.success(employeeService.getByEmpNo(empNo));
    }

    @RequestMapping("/query")
    public Result<Integer> query(){
        return Result.success(employeeService.list().size());
    }
}
